package com.luoc.service;

/**
 * @Author: luoc
 * @Date: 2019/10/11 11:24
 */
public class ChessMan {

    private String label;
    private int x;
    private int y;

    public ChessMan(String label, int x, int y) {
        this.label = label;
        this.x = x;
        this.y = y;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public void chage(int x,int y){
        this.x = x;
        this.y = y;
    }

    // 保存备忘录
    public ChessManMemento save(){
         return new ChessManMemento(this.label,this.x,this.y);
    }

    // 回车备忘录
    public void  resore(ChessManMemento manMemento){
            this.label = manMemento.getLabel();
            this.x= manMemento.getX();
            this.y = manMemento.getY();
    }

    @Override
    public String toString() {
        return "ChessMan{" +
                "label='" + label + '\'' +
                ", x=" + x +
                ", y=" + y +
                '}';
    }
}
